package com.avic.rong.userOrder.activity;

import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.avic.rong.BaseActivity;
import com.avic.rong.R;

import butterknife.BindView;

public class BankPayActivity extends BaseActivity {


    @BindView(R.id.tv_open_company)
    TextView tvOpenCompany;
    @BindView(R.id.tv_open_bank)
    TextView tvOpenBank;
    @BindView(R.id.tv_account)
    TextView tvAccount;
    @BindView(R.id.tv_hint)
    TextView tvHint;
    @BindView(R.id.tv_upload_proof)
    TextView tvUploadProof;
    private String order_id;
    private String orderType;
    private String  order_sn;
    public static String ORDER_ID = "order_id";
    public static String ORDER_SN = "order_sn";
    private int COMMENT_FORCODE = 6;
    @Override
    protected int getContentViewId() {
        return R.layout.activity_bank_pay;
    }

    @Override
    protected void initView() {
        if (!TextUtils.isEmpty(getIntent().getStringExtra("order_id"))||!TextUtils.isEmpty(getIntent().getStringExtra("order_sn"))) {
            order_id = getIntent().getStringExtra("order_id");
            order_sn = getIntent().getStringExtra("order_sn");

        } else {
           finish();
        }
        if (TextUtils.isEmpty(getIntent().getStringExtra("orderType"))){
            finish();
        }else {
            orderType = getIntent().getStringExtra("orderType");
        }
        tvTitle.setText("银行卡转账");

    }

    @Override
    protected void addListener() {
        tvUploadProof.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(BankPayActivity.this, UploadProofActivity.class);
                intent.putExtra("order_id",order_id);
                intent.putExtra("order_sn",order_sn);
                intent.putExtra("orderType",orderType);
                startActivity(intent);
            }
        });
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!orderType.equals("5")){
                    Intent intent = new Intent(context, OrderDetailsActivity.class);
                    intent.putExtra(ORDER_ID, order_id + "");

                    ((Activity) context).startActivityForResult(intent, COMMENT_FORCODE);
                }else {
                    Intent intent = new Intent(context, OrderDetailsPXActivity.class);
                    intent.putExtra(ORDER_SN, order_sn + "");

                    ((Activity) context).startActivityForResult(intent, COMMENT_FORCODE);
                }
            }
        });
    }

}
